/**
 * Created by python on 18-6-24.
 */
// 保存email
save_email: function(){
    var re = /^[a-z0-9][\w\.\-]*@[a-z0-9\-]+(\.[a-z]{2,5}){1,2}$/;
    if(re.test(this.email)) {
        this.email_error = false;
    } else {
        this.email_error = true;
        return;
    }
    axios.put(this.host + '/email/',
        { email: this.email },
        {
            headers: {
                'Authorization': 'JWT ' + this.token
            },
            responseType: 'json'
        })
        .then(response => {
            this.set_email = false;
            this.send_email_btn_disabled = true;
            this.send_email_tip = '已发送验证邮件'
        })
        .catch(error => {
            alert(error.data);
        });
}

